package homework.school;
import java.util.Arrays;
import java.util.Scanner;

public class Arrays1 {

    public static void main(String[] args) {
        int a = 10;



    }


    public static void main3(String[] args) {
        Scanner sc = new Scanner(System.in);
        //动态创建数组
        int[] arr = new int[sc.nextInt()];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = sc.nextInt();
        }
        int max = 0;
        /********** Begin **********/
        for (int i = 0; i < arr.length - 1; i++) {
            for (int j = 0; j < (arr.length - i - 1); j++) {
                if (arr[j + 1] > arr[j]) {
                    max = arr[j + 1];
                    arr[j + 1] = arr[j];
                    arr[j] = max;
                }
            }
        }

        System.out.print(Arrays.toString(arr));
    }

    public static void main2(String[] args) {
        Scanner sc = new Scanner(System.in);

        //str为要查找的字符串
        String str = sc.next();

        String arr[] = new String[]{"张三","张三丰","张无忌","王二麻子","张富贵"};

        for(int i = 0 ; i < arr.length ; i++ ){
            if(arr[i].equals(str)){
                System.out.println(str + "在数组的第" + i + "个位置");
            }
        }
    }



    public static void main1(String[] args) {
    Scanner sc = new Scanner(System.in);

    int[] scores = new int[sc.nextInt()];

    //循环给数组赋值
    for(int i = 0 ; i< scores.length;i++){
        scores[i] = sc.nextInt();
    }
    /********** Begin **********/
    //在这里计算数组scores的平均值和最大值
    float sum = 0;
    int max = scores[0];
    float avg;
    for(int i = 0; i < scores.length; i++){
        sum = sum + scores[i];

    }
    for(int i = 1; i < scores.length; i++){
        if(scores[i]>scores[i-1]){
            max = scores[i];
        }else{
            break;
        }
    }
    avg = sum / scores.length;
    System.out.println("平均值："+avg);
    System.out.println("最大值："+max);
    /********** End **********/
    }
}



